<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<!--
        	作者：offline
        	时间：2020-04-07
        	描述：开关灯
        -->
		<button id="switchLamp">开关灯</button>
		<button id="lbw">李博文</button>
		<img src="img/1.jpg"  title="李博文" alt="图片错误" id="sr"/ >
		<button id="img">美景图片</button>
		<script>
			var switchLamp=document.getElementById('switchLamp');
			var lbw=document.getElementById('lbw');
			var img=document.getElementById('img');
			var sr=document.getElementById('sr');
			var flag=0;
			switchLamp.onclick=function(){
				if (flag==0) {
					 document.body.style.backgroundColor = 'black';
					 flag=1;
				} else{
					 document.body.style.backgroundColor = '#DCDCDC';
					 flag=0;
				}
			}
			lbw.onclick=function(){
			 img.src="img/1.jpg" 
			 img.title='李博文';
			}
			sr.onclick=function(){
			 img.src="img/美景图片.jpg" ;
			 img.title='美景图片';
			}
		</script>
	</body>
</html>
